//
//  TabBarViewController.m
//  MZJ
//
//  Created by XDD on 16/6/2.
//  Copyright © 2016年 XDD. All rights reserved.
//

#import "TabBarViewController.h"
#import "ViewController.h"
#import "HomeViewController.h"
#import "HelpViewController.h"
#import "PublicViewController.h"
#import "PersonDataVC.h"
#import "RescueViewController.h"

@interface TabBarViewController ()<UITabBarControllerDelegate>

@end

@implementation TabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    HomeViewController *homeViewController = [[HomeViewController alloc]init];
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:homeViewController];
    UITabBarItem *homeItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"home_love_img@2x"] tag:1];
    nav1.tabBarItem = homeItem;
    
    [[UITabBar appearance]setBackgroundColor:[UIColor clearColor]];
    //    [[UITabBar appearance]setSelectedImageTintColor:[UIColor colorWithRed:81/255.0 green:159/255.0 blue:39/255.0 alpha:1]];
    [[UITabBar appearance] setTintColor:[UIColor colorWithRed:253/255.0 green:179/255.0 blue:10/255.0 alpha:1]];
    
    RescueViewController *rescueViewController = [[RescueViewController alloc]init];
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:rescueViewController];
    UITabBarItem *rescueItem = [[UITabBarItem alloc] initWithTitle:@"关于我们" image:[UIImage imageNamed:@"about_MY_img@2x"] tag:1];
    nav2.tabBarItem = rescueItem;
    
    PersonDataVC *personDataVC = [[PersonDataVC alloc]init];
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:personDataVC];
    UITabBarItem *personDataItem = [[UITabBarItem alloc] initWithTitle:@"个人中心" image:[UIImage imageNamed:@"person_data_img@2x"] tag:1];
    nav3.tabBarItem = personDataItem;
    

    
//    [XJNetWorkingManager successHandler:^(id responseObject) {
//        [DataModel object].home_img_Arr = responseObject[@"result"];
//        _pageControl.numberOfPages = _home_img_arr.count;
//        [_carousel_ScrollView setContentSize:CGSizeMake(kWidth*_home_img_arr.count, 0)];
//        for (int i = 0; i < _home_img_arr.count; i++) {
//            
//            UIButton *imageView_Btn = [UIButton buttonWithType:UIButtonTypeCustom];
//            imageView_Btn.frame = CGRectMake(kWidth*i, 0, kWidth, 0.31*kHeight);
//            imageView_Btn.backgroundColor = [UIColor redColor];
//            [imageView_Btn addTarget:self action:@selector(imageView_BtnAction) forControlEvents:UIControlEventValueChanged];
//            [view addSubview:imageView_Btn];
//            
//            UIImageView *imageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 0.31*kHeight)];
//            imageview.userInteractionEnabled = YES;
//            [imageview sd_setImageWithURL:[NSURL URLWithString:_home_img_arr[i][@"tiimg"]]
//                         placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
//            //                imageview.image = [UIImage imageNamed:[NSString stringWithFormat:@"yindao%d.png",i +1]];
//            [imageView_Btn addSubview:imageview];
//        }
        self.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nil];
        self.selectedIndex = 0;
        
//        NSLog(@"轮播 = %@",responseObject);
//    } failureHandler:^(NSError *error) {
//        
//    }];
    
}

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
    self.navigationController.navigationBarHidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
